import uniFetch from './uni-fetch.js'

/**
 * 登录接口函数
 */
export const loginApi = (data) => {
  if (!data.account || !data.password) return
  return uniFetch({
    url: '/driver/login/account',
    method: 'POST',
    data,
  })
}

/**
 * 获取个人信息
 */
export const profileApi = () => {
  return uniFetch.get('/driver/users')
}

/**
 * 任务数据
 * @param {string} year - 任务数据的年份
 * @param {string} month - 任务数据的月份
 */
export const taskApi = (year, month) => {
  return uniFetch.get('/driver/users/taskReport', { year, month })
}

/**
 * 车辆信息
 */
export const truckApi = () => {
  return uniFetch.get('/driver/users/truck')
}
